UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p5wYoyBxwtAjaXiHXUzJ2lfM3tevMon/uGVuoxU/NMY=' 
WHERE 
  key_id = '0f404de89141a7a471e898e06ddc42cc1602804a4da2c836d3a6316704a8a39b' 
  AND (
    token = 'p5wYoyBxwtAjaXiHXUzJ2lfM3tevMon/uGVuoxU/NMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031