UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQqPt9jxTPG1qWHMDLuTCfQJhIs4FyPMmth878xnDwk=' 
WHERE 
  key_id = '6dd6f25030392db7a818a01cf39b6759fb2955777335acca179d0bcc86dab1a6' 
  AND (
    token = 'iQqPt9jxTPG1qWHMDLuTCfQJhIs4FyPMmth878xnDwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027