UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '58gmpJgh5GeWl6NopGJafzctMOlhghs6d1nZLkAeMpQ=' 
WHERE 
  key_id = '4a53a7ea0a86ee715bae513cea1ee8f98b0e27bc0cedf339f9f015b309cba786' 
  AND (
    token = '58gmpJgh5GeWl6NopGJafzctMOlhghs6d1nZLkAeMpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042