UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'phh1UC5BJBrbWmRv1YOKOgerGiI1/Ds8TtgpTpzGYFQ=' 
WHERE 
  key_id = 'f4e14d1774ca790d22eb7f8a9e1768e94116786fb67ce4f83e65012c0b98feb3' 
  AND (
    token = 'phh1UC5BJBrbWmRv1YOKOgerGiI1/Ds8TtgpTpzGYFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036