UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hD9uWAx1/giBbiFN3y8Mh0sONZ9GCOkMIf0lmbx/R8w='
WHERE
key_id = '0b33c90fab06b84b1f169dabb4a0777a88469fc062ecd0c08e49653c07219635'
AND (
token = 'hD9uWAx1/giBbiFN3y8Mh0sONZ9GCOkMIf0lmbx/R8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)