UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z4fTZEwo03xPvBPMspKfgcRFDRNHKH94esDzBmAQeKI='
WHERE
key_id = '9f140b87ab64b987d32412927b532d736ced43b3127f8e858b740ca5596fe5fb'
AND (
token = 'Z4fTZEwo03xPvBPMspKfgcRFDRNHKH94esDzBmAQeKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)