UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aH3NcHjYM9cJPNSPqA/W92Z84Ku8Mcue8ThWScnNUPY='
WHERE
key_id = 'c378c5b033b13eb7f1167052f6d2da63c84ab56f9cfc8a3849ae58b02eacef72'
AND (
token = 'aH3NcHjYM9cJPNSPqA/W92Z84Ku8Mcue8ThWScnNUPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)