UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qLWi2/wS/RBcQTHIzzIzakEGuol6aWoAPi3CHtD3UlY='
WHERE
key_id = '7dc20545e3aded1ed542ce457181ad266036d7f23c23e7013cc0e49f2b5bc3f5'
AND (
token = 'qLWi2/wS/RBcQTHIzzIzakEGuol6aWoAPi3CHtD3UlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)