UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e6msfnQ6x50EClxz3mV6nNLjCxaY19agMnkfV2Gviuc=' 
WHERE 
  key_id = '52a6a4c2876ec34a1a63d2f8dc566aa11294073599079a4a22f5762afe5eb21d' 
  AND (
    token = 'e6msfnQ6x50EClxz3mV6nNLjCxaY19agMnkfV2Gviuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033