UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E519HTmP6aGXu8ygb+SMbZyu6Lr/8Ihqb8uBN0/sgtg=' 
WHERE 
  key_id = '7da9fc12297766092aad4a72824a8396ec3925732750c88bbfe36686d2cc3ead' 
  AND (
    token = 'E519HTmP6aGXu8ygb+SMbZyu6Lr/8Ihqb8uBN0/sgtg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032