UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IifgLhkWv3XGfqV5fIKfGlZPFEeSraGerfo/bdXgpk4='
WHERE
key_id = 'c36d52bad397152e0cf1de904ac094fdfba189459da7e4c2761b18a4c803be8e'
AND (
token = 'IifgLhkWv3XGfqV5fIKfGlZPFEeSraGerfo/bdXgpk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)