UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G3qjl/CMdZK8uYmvmJufcverHuFQoj9MqfU3RrO8H8w='
WHERE
key_id = '6ccac669207d96549992262529935c018e192ffc62522ea6574be4d27892eaea'
AND (
token = 'G3qjl/CMdZK8uYmvmJufcverHuFQoj9MqfU3RrO8H8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)