UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zd4yntEjbsgsD0ASqkqfQPoH1QJS1dpK0sB+oan8xZ8=' 
WHERE 
  key_id = 'edfa38448e8c8d7bb1f55f128099ae78ead161b0c8b1f9cdc84987929c47e02d' 
  AND (
    token = 'Zd4yntEjbsgsD0ASqkqfQPoH1QJS1dpK0sB+oan8xZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035