UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rGPpOaiHjdKv5UZ4cT/5c6IWR3iYEcdZqXesS6j+QfY=' 
WHERE 
  key_id = '773817097b5fe02b89456c2804943acec9526cf2e5d7f995107207a7d2501b42' 
  AND (
    token = 'rGPpOaiHjdKv5UZ4cT/5c6IWR3iYEcdZqXesS6j+QfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041