UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yST2DVY0pMdNGW7crA46RVIbWC/hme426//VwncVtqM=' 
WHERE 
  key_id = '025b7d2f39db94a4eea5cd410a5d99037d1dec8eeee72446cc9a5ce4b38409dd' 
  AND (
    token = 'yST2DVY0pMdNGW7crA46RVIbWC/hme426//VwncVtqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024