UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qJ57j70nmqcUHrSWJTTQa3OuoQJDQDndzNA+bzLFDLY='
WHERE
key_id = '7c6bce2958896b0c900ede68e3a7cb5dde7b114a3f544bc26eb80672f914f894'
AND (
token = 'qJ57j70nmqcUHrSWJTTQa3OuoQJDQDndzNA+bzLFDLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)