UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2ZQiABWKEcMBmnZCvPAKkQPBm3nGFaRBLAM5+Ehu6Y=' 
WHERE 
  key_id = '2321b1ebb6368e0764ea0020a518664bfc94695ffefee1bf983656191d67f91b' 
  AND (
    token = 'h2ZQiABWKEcMBmnZCvPAKkQPBm3nGFaRBLAM5+Ehu6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069