UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9byqqyJDfuD05DRg3R0jf3ep18SioHFtZlE9YHlGWFc='
WHERE
key_id = '187e562ee2aca197daad046faf2dbd95060db57018b6a8f9f1c1959e54041ecf'
AND (
token = '9byqqyJDfuD05DRg3R0jf3ep18SioHFtZlE9YHlGWFc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)