UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TVuA6JekJiepCES/SpBFDRU+cKxfDPplJbx4TrCR6dc='
WHERE
key_id = '2e712bd12336f26c7c452c6024937236a52cacc050871ec63a2a72c131a3a588'
AND (
token = 'TVuA6JekJiepCES/SpBFDRU+cKxfDPplJbx4TrCR6dc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)