UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HbcurqZV9Z6xJ2I3KvR8gB20FuqDK1suWlyFkehKeRE=' 
WHERE 
  key_id = '7da9cf960ea9fde43b390afb1df83c22d5582d65ed174d5cd28d1cb6329911ee' 
  AND (
    token = 'HbcurqZV9Z6xJ2I3KvR8gB20FuqDK1suWlyFkehKeRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038