UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tBS+1jyRDMkKUM03e1bux61dBr1gfiW5wCrpwLODFVM='
WHERE
key_id = '47cfb4e66622f9134af7478d110d1e16162395627b61467a5d6249a2bd43cbfc'
AND (
token = 'tBS+1jyRDMkKUM03e1bux61dBr1gfiW5wCrpwLODFVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)