UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WsswtCzRkidF8aDMYrOXQmScUgjpNBUpBS3crk7eUvI='
WHERE
key_id = '6d5d85630dc6f93313cd2ac2befb5f1f8dbf029a8819e38e4a8254020668b7b3'
AND (
token = 'WsswtCzRkidF8aDMYrOXQmScUgjpNBUpBS3crk7eUvI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)