UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S7w373cixMLG+lK4ToCGODHYx/JEEgMrtnkSmhKA+ZE='
WHERE
key_id = 'c24bc52cc4f4541aedbffb1d9361f48fda7faaacc96c97960977148c2b1feaf2'
AND (
token = 'S7w373cixMLG+lK4ToCGODHYx/JEEgMrtnkSmhKA+ZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)