UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sC3QSs/HabuK5LVTdvWhNwOFwJ9ZTxi7oWvSjw8dj2g=' 
WHERE 
  key_id = '778698e382d97d61918b263d4c81890ac185cea273993a699d6629a155d0875a' 
  AND (
    token = 'sC3QSs/HabuK5LVTdvWhNwOFwJ9ZTxi7oWvSjw8dj2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00124