UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+bQjeVP9KrKCvVFWkuJIM9VtEaWi7zhx1m0IDQocvBc=' 
WHERE 
  key_id = '59a6c13333a18dc55e83b103b37832abee5784cd5c165725b72903604593723c' 
  AND (
    token = '+bQjeVP9KrKCvVFWkuJIM9VtEaWi7zhx1m0IDQocvBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056