UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c7mnsV564GR7e9IZbetSuRhrj4TXORuSC2SHYazG8Og=' 
WHERE 
  key_id = 'db2226b7c90c73e6abecc4842f9abcc8cee9d6e1b1f73e2bec02a2df1e742d1d' 
  AND (
    token = 'c7mnsV564GR7e9IZbetSuRhrj4TXORuSC2SHYazG8Og=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029