UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bYjOAkD5IGWHwZjGEUZ61BrTHtK921avsGfb2uIaoIc=' 
WHERE 
  key_id = '935689fb2a2514c42ca352faa7c74252f417710a75a3a5e7728374d2efce6613' 
  AND (
    token = 'bYjOAkD5IGWHwZjGEUZ61BrTHtK921avsGfb2uIaoIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036