UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XYNjWw5/dZAZEtiJs5gp8hpoyudZMul0QClFeQI7H54='
WHERE
key_id = 'e712230ebc8811f908f53a2f8665465d17a327a2d14d9d106d53c38f76a2300e'
AND (
token = 'XYNjWw5/dZAZEtiJs5gp8hpoyudZMul0QClFeQI7H54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)