UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'APLJgV3xFj5jyOvsIqyJByxO+qlwX+UwlMoXDU7ZVdA='
WHERE
key_id = '27455f1fe1d7075f3640b3e64242f294d9d48199d1acdd5d3c375608d7355d9e'
AND (
token = 'APLJgV3xFj5jyOvsIqyJByxO+qlwX+UwlMoXDU7ZVdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)