UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6r5vv6CAAJG8Ay3XoWRcPkja0ih1b8FnNiu3eIRvrEc='
WHERE
key_id = 'dfce24956ef039e82f5ab0890b17fed2b644b8e858ede355d5f047041761eb56'
AND (
token = '6r5vv6CAAJG8Ay3XoWRcPkja0ih1b8FnNiu3eIRvrEc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)