UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77Cx3turn4mtOHCAawKbDOjxAauWBPTdxs84OFFPL4A=' 
WHERE 
  key_id = '3f2ec077cce337d4cc9486d71587d8539c7ac0f422291e57bc1193aeea0d4d1d' 
  AND (
    token = '77Cx3turn4mtOHCAawKbDOjxAauWBPTdxs84OFFPL4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041