UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g29gkARZU/NyahdOgwBRcGYYhj2g4mgZ5i7ZhkMdoYQ=' 
WHERE 
  key_id = '566bb3277dcaba8386f76182e39530b080b5f2492f185e0352c77e37e73ec04e' 
  AND (
    token = 'g29gkARZU/NyahdOgwBRcGYYhj2g4mgZ5i7ZhkMdoYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017