UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wY3stmcUE4lwRB8GYdSybzUWLGnWPbDrr8EwMr5NZjs='
WHERE
key_id = 'dbbc81e26cfbc92dc1ae3e74f927b3e22e0f8786bceff7b878ce6fe366ffa94a'
AND (
token = 'wY3stmcUE4lwRB8GYdSybzUWLGnWPbDrr8EwMr5NZjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)