UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQkxBDHLlPzyQnKlpmyBPls0Ghq+5lqc6U2gXHSAf58=' 
WHERE 
  key_id = 'b8765c2129be093737d2ba646459e015f08ca57a965c91c1e7a32bc0e84fd189' 
  AND (
    token = 'bQkxBDHLlPzyQnKlpmyBPls0Ghq+5lqc6U2gXHSAf58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021