UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cop7PpVr5FJx9MK3f7EjxigUa4cd4SkhkA/9EzmMA9A='
WHERE
key_id = 'c6bae45fd5de1d2c56c47a4dd98be8d713bb0303c8a1d0a92a3548e34c9c9c3d'
AND (
token = 'cop7PpVr5FJx9MK3f7EjxigUa4cd4SkhkA/9EzmMA9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)