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

Query time 0.00031