UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aml4vfSz9Nf55wu+0rrCA9WAAkp/fu5tieUuwK+uZlM='
WHERE
key_id = '9d43a8d95761326730449c4d70b2e5d905ec7a04a0b0d92149342208fea192bc'
AND (
token = 'aml4vfSz9Nf55wu+0rrCA9WAAkp/fu5tieUuwK+uZlM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)